<template>
  <div class="coupon-container">
    <div class="coupon-title">
      <div class="left">
        <span class="iconfont icon-tubiaolunkuo"></span> 购物车可领优惠券
      </div>
      <div class="right" @click="toggleShowCouponHandler()">
        领券 <span class="iconfont icon-xiajiantou1"></span>
      </div>
    </div>
    <div class="coupon-detail" :class="{ show: showCoupon }">
      暂时没有可领的优惠券
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      showCoupon: false
    }
  },

  methods: {
    /**
     * 展示或者不展示优惠券容器
     */
    toggleShowCouponHandler () {
      this.showCoupon = !this.showCoupon
    }
  }
}
</script>

<style lang="less" scoped>
@import "../../styles/variable";

.coupon-container {
  .coupon-title {
    align-items: center;
    border: 1px solid @line-color-light2;
    display: flex;
    height: 40px;
    justify-content: space-between;
    .left {
      align-items: center;
      display: flex;
      font-size: 14px;
      .iconfont {
        color: @font-color-tag-danger;
        font-size: 28px;
        margin: 0px 16px;
      }
    }
    .right {
      align-items: center;
      background: @font-color-tag-danger;
      color: @write;
      cursor: pointer;
      display: flex;
      font-size: 12px;
      width: 88px;
      height: 100%;
      justify-content: center;
      .iconfont {
        font-size: 10px;
        margin-left: 10px;
      }
    }
  }
  .coupon-detail {
    align-items: center;
    border: 1px solid @line-color-light2;
    border-top: 0px;
    color: @font-color-six;
    display: flex;
    font-size: 14px;
    height: 0px;
    opacity: 0;
    overflow: hidden;
    justify-content: center;
    transition: all 500ms ease;
    &.show {
      opacity: 1;
      height: 156px;
    }
  }
}
</style>
